The present invention relates generally to the field of data communications, and more particularly, to the field of serial communications bus controllers and microcontrollers that incorporate the same.
CAN (Control Area Network) is an industry-standard, two-wire serial communications bus that is widely used in automotive and industrial control applications, as well as in medical devices, avionics, office automation equipment, consumer appliances, and many other products and applications. CAN controllers are currently available either as stand-alone devices adapted to interface with a microcontroller or as circuitry integrated into or modules embedded in a microcontroller chip. Since 1986, CAN users (software programmers) have developed numerous high-level CAN Application Layers (CALs) which extend the capabilities of the CAN while employing the CAN physical layer and the CAN frame format, and adhering to the CAN specification. CALs have heretofore been implemented primarily in software, with very little hardware CAL support. Consequently, CALs have heretofore required a great deal of host CPU intervention, thereby increasing the processing overhead and diminishing the performance of the host CPU.
Thus, there is a need in the art for a CAN hardware implementation of CAL functions normally implemented in software in order to offload these tasks from the host CPU to the CAN hardware, thereby enabling a great savings in host CPU processing resources and a commensurate improvement in host CPU performance. One of the most demanding and CPU resource-intensive CAL functions is message management, which entails the handling, storage, and processing of incoming CAL/CAN messages received over the CAN serial communications bus and/or outgoing CAL/CAN messages transmitted over the CAN serial communications bus. CAL protocols, such as DeviceNet, CANopen, and OSEK, deliver long messages distributed over many CAN frames, which methodology is sometimes referred to as xe2x80x9cfragmentedxe2x80x9d or xe2x80x9csegmentedxe2x80x9d messaging. The process of assembling such fragmented, multi-frame messages has heretofore required a great deal of host CPU intervention. In particular, CAL software running on the host CPU actively monitors and manages the buffering and processing of the message data, in order to facilitate the assembly of the message fragments or segments into complete messages.
Based on the above and foregoing, it can be appreciated that there presently exists a need in the art for a hardware implementation of CAL functions normally implemented in software in order to offload these tasks from the host CPU, thereby enabling a great savings in host CPU processing resources and a commensurate improvement in host CPU performance.
The assignee of the present invention has recently developed a new microcontroller product, designated xe2x80x9cXA-C3xe2x80x9d, that fulfills this need in the art. The XA-C3 is the newest member of the Philips XA (eXtended Architecture) family of high performance 16-bit single-chip microcontrollers. It is believed that the XA-C3 is the first chip that features hardware CAL support.
The XA-C3 is a CMOS 16-bit CAL/CAN 2.0B microcontroller that incorporates a number of different inventions, including the present invention. These inventions include novel techniques and hardware for filtering, buffering, handling, and processing CAL/CAN messages, including the automatic assembly of multi-frame fragmented messages with minimal CPU intervention, as well as for managing the storage and retrieval of the message data, and the memory resources utilized therefor.
The present invention relates to a CAN microcontroller that supports a plurality (e.g., 32) of message objects, each one of which is assigned a respective message buffer within an on-chip and/or off-chip portion of the overall data memory space of the CAN microcontroller. The location and size of each of the message buffers can be reconfigured by the user (programmer) by simple programming of memory-mapped registers provided for this purpose. The message buffers are used to store incoming (receive) messages and to stage outgoing (transmit) messages. With the XA-C3 microcontroller that constitutes a presently preferred implementation of the present invention, Direct Memory Access (DMA) is employed to enable the XA-C3 CAN module to directly access any of the 32 message buffers without interrupting the processor core. This message storage scheme provides a great deal of flexibility to the user, as the user is free to use as much or as little message storage area as an application requires, and is also free to position the message buffers wherever it is most convenient.
This message storage scheme is a key element of the unique xe2x80x9cmessage managementxe2x80x9d capabilities of the XA-C3 CAN microcontroller, as this scheme enables the XA-C3 CAN/CAL module to concurrently assemble many (up to 32) incoming, fragmented messages of varying lengths, and, at the same time, stage multiple outgoing messages for transmission. Since incoming message assembly is handled entirely in hardware, the processor is free to perform other tasks, typically until a complete message is received and ready for processing.
The present invention encompasses, in one of its aspects, a method implemented in a CAN device, e.g., a CAN microcontroller, that supports a plurality of message objects, that includes concurrently staging two or more transmit messages associated with respective ones of two or more enabled transmit message objects for attempted transmission over a CAN bus coupled to the CAN device, and performing a pre-arbitration process to determine which of the two or more concurrently staged transmit messages has priority. The message determined to have priority is deemed a winning message and the message object associated with the winning message is deemed a winning message object.
In a presently preferred embodiment, the pre-arbitration process is a selected one of at least two pre-arbitration schemes, including a first pre-arbitration scheme whereby priority is determined according to a CAN bus arbitration priority scheme established by the governing CAN protocol, and a second pre-arbitration scheme whereby priority is determined by selecting the transmit message associated with the highest-numbered (or, alternatively, lowest-numbered) message object as the winning message. In the event that more than one of the two or more concurrently staged transmit messages are determined to have the same priority, the transmit message associated with the highest-numbered message object is designated as the winning message. The method further includes attempting to transmit the winning message over the CAN bus. If the winning message is not granted access to the CAN bus, the pre-arbitration priority determination process is repeated.
In another of its aspects, the present invention encompasses a CAN device, e.g., a CAN microcontroller, that implements the above-described method of the present invention. In a presently preferred embodiment, the CAN microcontroller includes a plurality of message buffers associated with respective ones of the message objects, a processor core for running CAN applications, a CAN/CAL module for processing transmit and receive messages, at least one object-specific control register associated with each message object, at least one global control register, and a DMA engine that enables the CAN/CAL module to directly access the message buffers without interrupting the processor core.
The at least one object-specific control register associated with each message object is programmable for the purpose of enabling or disabling the associated message object as a transmit or receive message object, thereby providing a user with the capability to concurrently stage two or more transmit messages for attempted transmission over a CAN bus coupled to the CAN microcontroller, according to a governing CAN protocol.
The CAN/CAL module includes a transmit pre-arbitration engine that determines which of the two or more transmit messages concurrently staged for attempted transmission over the CAN bus has priority. Preferably, each of the message buffers has a size and a location that are programmable. In this regard, the CAN microcontroller preferably further includes a plurality of individual message object registers associated with each of the message objects that contain fields of command/control information that facilitate configuration and setup of the associated message object, including at least one buffer size register that contains a message buffer size field that enables the size of the message buffer associated with the associated message object to be programmed, and at least one buffer location register that contains a message buffer location field that enables the location of the message buffer associated with the associated message object to be programmed.
Preferably, the CAN/CAL module further includes a transmit engine that invokes the DMA engine to retrieve the winning message from the message buffer associated with the winning message object, and then attempts to transmit the winning message over the CAN bus according to the CAN bus arbitration priority scheme established by the governing CAN protocol. If the winning message is not granted access to the CAN bus according to the CAN bus arbitration priority scheme, the transmit pre-arbitration engine is reset to repeat the pre-arbitration priority determination process. The global control register is programmable for the purpose of permitting a user to select one of the at least two pre-arbitration schemes.